var e = require("../../../@babel/runtime/helpers/interopRequireDefault")(require("../../../@babel/runtime/regenerator")), t = require("../../../@babel/runtime/helpers/asyncToGenerator");

Component({
    properties: {},
    data: {},
    methods: {}
});

var a = require("../../../poster/poster"), r = getApp();

Component({
    behaviors: [ a ],
    properties: {
        urlapi: {
            type: null
        },
        activityid: {
            type: null
        }
    },
    data: {},
    ready: function() {},
    methods: {
        getPosterPic: function() {
            var a = this;
            return t(e.default.mark(function t() {
                var i;
                return e.default.wrap(function(e) {
                    for (;;) switch (e.prev = e.next) {
                      case 0:
                        i = r.getNetAddresss(a.properties.urlapi), wx.showLoading({
                            title: "加载中"
                        }), r._getNetWork({
                            url: i,
                            data: {
                                id: a.properties.activityid
                            },
                            success: function(e) {
                                wx.hideLoading();
                                var t = e.data;
                                1 == t.result ? a.setData({
                                    poster: t.data.poster
                                }) : wx.showModal({
                                    title: "提示",
                                    content: t.msg,
                                    showCancel: !1,
                                    success: function(e) {
                                        e.confirm && a.setData({
                                            isshow: !1,
                                            getFlag: !0
                                        });
                                    }
                                });
                            },
                            fail: function() {
                                wx.hideLoading();
                            }
                        });

                      case 3:
                      case "end":
                        return e.stop();
                    }
                }, t);
            }))();
        },
        saveImg: function() {
            var e = this.data.poster, t = wx.env.USER_DATA_PATH + "/solitaire_qrcodehaibao.png", a = e.replace(/^data:image\/\w+;base64,/, ""), r = wx.getFileSystemManager();
            r.writeFileSync(t, a, "base64"), wx.saveImageToPhotosAlbum({
                filePath: t,
                success: function(e) {
                    r.unlinkSync(t), wx.showToast({
                        title: "保存成功",
                        icon: "none",
                        duration: 2e3
                    });
                },
                fail: function(e) {
                    console.log(e);
                }
            });
        }
    }
});